package org.hang.exception;

/**
 * 使用枚举封装错误码
 */
public enum ResponseCode {
    /*
    异常统一处理第一步，将错误码和错误的描述封装进枚举对象
     */
    //枚举的对象，包含错误码和错误的描述
    RESPONSE_CODE_50001(50001,"当前购物车数据不存在,请检查后重新操作!"),
    RESPONSE_CODE_200(200,"操作成功!"),
    RESPONSE_CODE_400(400,"参数错误!"),
    RESPONSE_CODE_400001(400001,"两次密码不一致,请检查后重新提交!"),
    RESPONSE_CODE_400002(400002,"店铺已存在,请检查后重新提交!"),
    RESPONSE_CODE_400003(400003,"该店铺管理员信息重复!"),
    RESPONSE_CODE_400004(400004,"店铺名字违规"),
    RESPONSE_CODE_400005(400005,"店铺logo违规"),
    RESPONSE_CODE_400006(400006, "未添加驳回备注!"),
    RESPONSE_CODE_400007(400007, "店铺激活码过期!"),
    RESPONSE_CODE_400008(400008, "店铺激活码错误!"),
    RESPONSE_CODE_400009(400009, "该手机号已经注册过,请直接登录"),
    RESPONSE_CODE_400010(400010, "图形验证码过期,请重新获取"),
    RESPONSE_CODE_400011(400011, "图形验证码不一致"),
    RESPONSE_CODE_400012(400012, "发送过于频繁，请稍后再试"),
    RESPONSE_CODE_400013(400013, "手机验证码有误，请重新输入"),
    RESPONSE_CODE_400014(400014, "用户名或密码错误"),
    RESPONSE_CODE_400015(400015, "请选择具体的商品进行上架!"),
    RESPONSE_CODE_400016(400016, "请上架审核通过的商品!"),
    RESPONSE_CODE_400017(400017, "请选择具体的商品进行下架!"),
    RESPONSE_CODE_400018(400018, "当前操作的购物车不存在,请重新操作!"),
    RESPONSE_CODE_500(500,"网络异常!请稍后重试!");

    //构造方法
    ResponseCode(Integer code, String msg) {
        this.code = code;
        this.msg = msg;
    }

    private Integer code; //错误码
    private String msg;  //错误的描述

    //因为其他类要获取错误码和错误的描述，所以要提供公共访问方法
    public Integer getCode() {
        return code;
    }

    public void setCode(Integer code) {
        this.code = code;
    }

    public String getMsg() {
        return msg;
    }

    public void setMsg(String msg) {
        this.msg = msg;
    }
}
